package com.freemypay.非web应用程序实例;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class SpringBootConsoleApplication implements CommandLineRunner {

	@Autowired
    private HelloMessageService helloService;

    public static void main(String[] args) throws Exception {
    	//disabled banner, don't want to see the spring logo
        SpringApplication app = new SpringApplication(SpringBootConsoleApplication.class);
//        app.setBannerMode(Banner.Mode.OFF);
        app.run(args);

    }

    //access command line arguments
    public void run(String... args) throws Exception {
    	// TODO Auto-generated method stub
    	 if (args.length > 0) {
             System.out.println(helloService.getMessage(args[0].toString()));
         } else {
             System.out.println(helloService.getMessage());
         }

//         exit(0);
    }
}
